import { useState } from 'react';
import { useRequest } from 'umi';
import { queryCardList } from '@/pages/Card/services';
import { createModel } from 'hox';

export interface stateProps {
  selectedRowKeys: any[];
  params: any;
}
function useBlankCardModel() {
  const [state, setState] = useState<stateProps>({
    selectedRowKeys: [],
    params: {
      keyword: undefined,
      number: 10,
      page: 1,
    },
  });
  //获取卡片接口
  const { run: getBlankCardList } = useRequest(queryCardList, {
    manual: true,
  });
  const dispatch = (payload: Partial<stateProps>) => {
    setState({ ...state, ...payload });
  };
  return { ...state, getBlankCardList, dispatch };
}
export default createModel(useBlankCardModel);
